package com.cms.server.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cms.server.model.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Optional;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("SELECT * FROM user WHERE username = #{name} and status = 1")
    Optional<User> selectByName(String name);

    @Select("select userid, username from user")
    List<User> selectAllName();

    @Select("select * from user where userid = #{userid} and status = 1 and password = #{password}")
    User selectByIdAndPassword(int userid, String password);
}
